Skip to content

Learning path subscription email fix - #1150

Merged
fbacall merged 2 commits into
masterfrom
digest-email-fix
Sep 30, 2025
Merged

Learning path subscription email fix#1150
fbacall merged 2 commits into
masterfrom
digest-email-fix

Conversation

@fbacall

@fbacall fbacall commented Sep 24, 2025

Copy link
Copy Markdown
Member

Summary of changes

  • Fixes a ActionView::Template::Error trying to render the email template when sending a user a digest email for a learning path subscription.
  • Added back the underline to links in the HTML email to make it obvious they are clickable.

Motivation and context

Error reported via Sentry in production.

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree
    to license it to the TeSS codebase under the
    BSD license.

@fbacall
fbacall requested a review from Copilot September 24, 2025 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the learning path subscription email functionality that was causing a ActionView::Template::Error in production. The fix ensures proper template rendering and improves email link styling.

  • Replaced dynamic partial rendering with conditional logic to avoid template errors for learning paths
  • Added conditional checks to prevent collection-related functionality from appearing in learning path emails
  • Restored underline styling to email links for better usability

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
app/mailers/subscription_mailer.rb Updates subject line to use localized resource names instead of hardcoded types
app/views/subscription_mailer/digest.html.erb Replaces dynamic partial rendering with conditional logic and adds type checks for collections
app/views/subscription_mailer/digest.text.erb Adds type check to prevent collection functionality for non-supported types
app/views/subscription_mailer/_resources.html.erb Removes text-decoration:none and adds conditional check for description method
app/views/subscription_mailer/_events.html.erb Removes text-decoration:none to restore underlines on links
test/mailers/subscription_mailer_test.rb Adds comprehensive test for learning path digest email functionality
test/mailers/previews/subscription_mailer_preview.rb Adds preview method for learning path digest emails
test/fixtures/subscriptions.yml Adds test fixture for learning path subscriptions
test/controllers/subscriptions_controller_test.rb Updates test to use dynamic count instead of hardcoded value

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

<%= link_to(result.title, result, style: 'color: #f57d20; font-weight: bold; text-decoration: none') %><br/>
<%= truncate(result.description, length: 120, separator: ' ') %><br/><br/>
<%= link_to(result.title, result, style: 'color: #f57d20; font-weight: bold;') %><br/>
<% if result.respond_to?(:description) %>

Copilot AI Sep 24, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using respond_to? for feature detection is fragile and can hide real issues. Consider using a more explicit check like result.is_a?(Material) or checking if the result has a description attribute directly with result.try(:description) if using Rails.

Suggested change
<% if result.respond_to?(:description) %>
<% if result.try(:description) %>

Copilot uses AI. Check for mistakes.
@fbacall
fbacall merged commit bfca242 into master Sep 30, 2025
11 checks passed
@fbacall
fbacall deleted the digest-email-fix branch September 30, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants